﻿<%@ Page language="c#" Inherits="Mysoft.Crm.Web.Controls.Lookup.LookupSubjectPage" CodeBehind="Mysoft.Crm.Application.Pages.Controls.dll" %>
<%@ Register TagPrefix="cnt" Namespace="Mysoft.Crm.Application.Controls" Assembly="Mysoft.Crm.Application.Components" %>
<%@ Register TagPrefix="frm" Namespace="Mysoft.Crm.Application.Forms" Assembly="Mysoft.Crm.Application.Components" %>
<%@ Import Namespace="Mysoft.Crm.Web.Controls.Lookup"%>
<html>
<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"/>
<title>Look Up a Subject</title>
<cnt:AppHeader id="crmHeader" runat="server" />
<link rel="stylesheet" type="text/css" href="lookupdialogs.css">
<script language="javascript" src="lookupdialogs.js"></script>

<style>
	DIV.objects
	{
		overflow-y:	visible;
		overflow-x:	visible;
	}
</style>

<script language="javascript">

	<%= fetchArray %>
	<%= xslArray %>
	var _bMultiSelect = <%= multiSelect.ToString().ToLower() %>;

	var _oXml = new ActiveXObject("Microsoft.XMLDOM");
	var _oXsl = new ActiveXObject("Microsoft.XMLDOM");

	var sReturnData	= null;
	var currentSubject = null;
	
	_oXml.async = false;
	_oXsl.async = false;
	
	
	function window.onload()
	{
		TreeSubject.attachEvent("ondblclick", applychanges);
	}

	function getSubject( subject )
	{
		currentSubject = subject;
		trNone.runtimeStyle.backgroundColor = "";
	}
		
	function applychanges()
	{
		if (currentSubject != null)
		{
			var lookupItems = new LookupItems();

			if (currentSubject != "")
			{
				var oLookupItem = new LookupItem();
				
				oLookupItem.id			= currentSubject.Id;
				oLookupItem.name		= currentSubject.Name;
				oLookupItem.html		= "<img class=\"lui\" src=\"/_imgs/ico_16_129.gif\">" + HtmlEncode(currentSubject.Name);
				oLookupItem.type		= 129;
				oLookupItem.values		= null;
				oLookupItem.keyValues	= null;
				
				lookupItems.items.push(oLookupItem);
			}

			window.returnValue = lookupItems;
			window.close();
		}
		else
		{
			alert("您必须选择一个主题。");//^^
			//alert(  "You must select a subject."  );
		}
	}
	
	function cancel()
	{
		window.close();
	}

	function handleNone()
	{
		TreeSubject.rows[0].cells[0].Clear();
		currentSubject = "";
		trNone.runtimeStyle.backgroundColor = "#CAD3E4";		
	}
	
	function handleNoneDblClick()
	{
		handleNone();
		applychanges();
	}	
	
</script>
</head>
<body>
	<frm:DialogForm id="crmForm" runat="server">
		<table width="100%" height="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td>
					<table height="100%" width="100%" cellspacing="0" cellpadding="0">
						<tr height="10">
							<td>
								<table class="listHeaderBar" cellspacing="0" cellpadding="0" width="100%">
									<tr>
										<td class="column"><!-Subjects->主题</td><!- //^^->
									</tr>
								</table>
							</td>
						</tr>
						<tr><td>
							<div class="objects">
								
								<table height="100%" width="100%" cellspacing="0" cellpadding="0">
									<tr height="20" onclick="handleNone();" ondblclick="handleNoneDblClick();" id="trNone">
										<td nowrap class="sel" style="padding:3px;padding-top:5px;border-bottom:1px solid #cccccc;">
											<img src="/_imgs/ico_18_role_x.gif" align="absmiddle" style="margin-right: 3px;"><!-None->空<!- //^^->
										</td>
									</tr>
									<tr>
										<td><cnt:AppTree id="crmTree" runat="server"/></td>
									</tr>
								</table>
								
							</div>
						</td></tr>
					</table>
				</td>
			</tr>
		</table>
	</frm:DialogForm>
</body>
</html>
